using System;
using System.Collections.Generic;
using System.Text;
using THSERP.BusinessEntities;
using THSERP.BaseProvider;
namespace THSERP.Modules.ProjectMaterial
{
    public class ProjectMaterialEntities : ERPModuleEntities
    {
        #region Declare Constant
        public readonly static String strPMProjectMaterialsObjectName = "PMProjectMaterials";
        public readonly static String strPMProjectMaterialItemsObjectName = "PMProjectMaterialItems";
        #endregion

        #region Declare all entities variables
        private PMProjectMaterialsInfo _pMProjectMaterialsObject;
        private PMProjectMaterialItemsInfo _pMProjectMaterialItemsObject;

        public THSItemsEntityList<ProjectMaterialItemsEntity> lstPMProjectMaterialItems;
        #endregion

        #region Public Properties
        public PMProjectMaterialsInfo PMProjectMaterialsObject
        {
            get
            {
                return _pMProjectMaterialsObject;
            }
            set
            {
                _pMProjectMaterialsObject = value;
            }
        }
        public PMProjectMaterialItemsInfo PMProjectMaterialItemsObject
        {
            get
            {
                return _pMProjectMaterialItemsObject;
            }
            set
            {
                _pMProjectMaterialItemsObject = value;
            }
        }

        public THSItemsEntityList<ProjectMaterialItemsEntity> PMProjectMaterialItemsList
        {
            get
            {
                return lstPMProjectMaterialItems;
            }
            set
            {
                lstPMProjectMaterialItems = value;
            }
        }

        #endregion

        #region Constructor
        public ProjectMaterialEntities()
            : base()
        {
            _pMProjectMaterialsObject = new PMProjectMaterialsInfo();

            _pMProjectMaterialItemsObject = new PMProjectMaterialItemsInfo();

            lstPMProjectMaterialItems = new THSItemsEntityList<ProjectMaterialItemsEntity>();
        }

        #endregion

        #region Init Main Object,Module Objects functions
        public override void InitMainObject()
        {

            MainObject = PMProjectMaterialsObject;
        }

        public override void InitModuleObjects()
        {
            ModuleObjects.Add(ProjectMaterialEntities.strPMProjectMaterialItemsObjectName, PMProjectMaterialItemsObject);
        }

        public override void InitModuleObjectList()
        {
            lstPMProjectMaterialItems.InitTHSList(this, ProjectMaterialEntities.strPMProjectMaterialsObjectName, ProjectMaterialEntities.strPMProjectMaterialItemsObjectName);
        }

        public override void InitGridControlInTHSList()
        {
            lstPMProjectMaterialItems.InitTHSListGridControl();
        }

        public override void SetDefaultModuleObjectsList()
        {
            try
            {
                lstPMProjectMaterialItems.SetDefaultListAndRefreshGridControl();

            }
            catch (Exception)
            {
                return;
            }
        }

        #endregion

        #region Invalidate Module Objects functions


        public override void InvalidateModuleObjects(int iObjectID)
        {
            PMProjectMaterialItemsList.Invalidate(iObjectID);
        }


        #endregion

        #region Save Module Objects functions

        public override void SaveModuleObjects()
        {
            PMProjectMaterialItemsList.SaveItemObjects(true);
        }

        #endregion

        public override void SetValuesAfterValidateProduct(int iICProductID)
        {
            PMProjectMaterialItemsList.SetDefaultValuesFromProduct(iICProductID);
        }
    }
}
